home *** CD-ROM | disk | FTP | other *** search
- // Copyright (C) 1997-2002 Alias|Wavefront,
- // a division of Silicon Graphics Limited.
- //
- // The information in this file is provided for the exclusive use of the
- // licensees of Alias|Wavefront. Such users have the right to use, modify,
- // and incorporate this code into other products for purposes authorized
- // by the Alias|Wavefront license agreement, without fee.
- //
- // ALIAS|WAVEFRONT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- // INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- // EVENT SHALL ALIAS|WAVEFRONT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- // CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- // DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- // TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- // PERFORMANCE OF THIS SOFTWARE.
- //
- //
- // Alias|Wavefront Script File
- // MODIFY THIS AT YOUR OWN RISK
- //
- // Creation Date: Aug 12 1996
- // Author: cdg
- //
- // Description:
- // This script creates the UI for the main window on startup.
- //
- // Input Arguments:
- // None.
- //
- // Return Value:
- // None.
- //
- // Note:
- // None.
- //
- {
- int $printMemoryExists = `exists printMemory`;
- if ($printMemoryExists) {
- printMemory("Static initializers complete");
- }
- global string $gMainWindow = "";
- global string $gCommandWindow = "CommandWindow";
-
- //
- // Determine values for initial setup states
- //
- int $buildMainWindow = !`optionVar -q mainWindowDisable`;
-
- //
- // Get the window positions before creating any windows
- //
- windowPref -enableAll `optionVar -q saveWindowPos`;
- if (`optionVar -q saveWindowPos`) {
- windowPref -loadAll;
- }
-
- // Force out of xformNoSelect mode
- selectPref -xformNoSelect off;
-
- //
- // Start building the application UI.
- //
-
- if (`exists setDefaultTemplates`) {
- eval "source setDefaultTemplates";
- }
-
- setStartupMessage("Initializing Script Editor.");
- if (`exists initCommandWindow`) eval "source initCommandWindow";
-
- if ($buildMainWindow && `exists initMainWindow`) {
-
- source initMainWindow;
-
- source initContexts;
-
- if (`isTrue "AnimationExists"` && `exists animationStartup`) {
- eval "source animationStartup";
- }
-
- ////////////////////////////////////////////////////////////
- //
- // Attribute Editor
- //
- ////////////////////////////////////////////////////////////
- if(`exists initAttributeEditor`) {
- if($printMemoryExists) {
- printMemory("Attribute Editor Start");
- }
- setStartupMessage("Initializing Attribute Editor");
- eval "source initAttributeEditor";
- if ($printMemoryExists) {
- printMemory("Attribute Editor Complete");
- }
- }
-
- ////////////////////////////////////////////////////////////
- //
- // Tool Settings
- //
- ////////////////////////////////////////////////////////////
- if(`exists initToolSettings`) {
- if($printMemoryExists) {
- printMemory("Tool Settings Start");
- }
- setStartupMessage("Initializing Tool Settings");
- eval "source initToolSettings";
- if ($printMemoryExists) {
- printMemory("Tool Settings Complete");
- }
- }
-
- ////////////////////////////////////////////////////////////
- //
- // Channel Box and Layer Editor Area.
- //
- ////////////////////////////////////////////////////////////
- if(`exists initChannelsLayers`) {
- if($printMemoryExists) {
- printMemory("Channel Box and Layer Editor Start");
- }
- setStartupMessage("Initializing Channel Box and Layer Editor");
- eval ("source initChannelsLayers");
- if ($printMemoryExists) {
- printMemory("Channel Box and Layer Editor Complete");
- }
- }
-
- ////////////////////////////////////////////////////////////
- //
- // Main window view panes.
- //
- ////////////////////////////////////////////////////////////
- if (`exists initMainPane`) {
- setStartupMessage("Initializing View Panes.");
- eval "source initMainPane";
- if ($printMemoryExists) {
- printMemory("Main Pane Complete");
- }
- }
-
- ////////////////////////////////////////////////////////////
- //
- // Panels.
- //
- ////////////////////////////////////////////////////////////
- if (`exists initPanels`) {
- setStartupMessage("Initializing Panels.");
- eval "source initPanels";
- if ($printMemoryExists) {
- printMemory("Panels Complete");
- }
- }
-
- ////////////////////////////////////////////////////////////
- //
- // Status line.
- //
- ////////////////////////////////////////////////////////////
-
- if (`exists initStatusLine`) {
- setStartupMessage("Initializing Status Line.");
- eval "source initStatusLine";
- if ($printMemoryExists) {
- printMemory("Status Line Complete");
- }
- }
-
- ////////////////////////////////////////////////////////////
- //
- // Time slider and Playback range.
- //
- ////////////////////////////////////////////////////////////
- if (`isTrue "AnimationExists"` && `exists initTimeSlider` ) {
- setStartupMessage("Initializing Time Slider.");
- eval "source initTimeSlider";
- eval "source initPlaybackRange";
- }
-
- ////////////////////////////////////////////////////////////
- //
- // Command line.
- //
- ////////////////////////////////////////////////////////////
- if (`exists initCommandLine` ) {
- setStartupMessage("Initializing Command Line.");
- eval "source initCommandLine";
- }
-
- ////////////////////////////////////////////////////////////
- //
- // Shelf.
- //
- ////////////////////////////////////////////////////////////
- if (`exists initShelf`) {
- if ($printMemoryExists) {
- printMemory("Shelf Start");
- }
- setStartupMessage("Initializing Shelf.");
- eval "source initShelf";
- if ($printMemoryExists) {
- printMemory("Shelf Complete");
- }
- }
-
- ////////////////////////////////////////////////////////////
- //
- // Help line.
- //
- ////////////////////////////////////////////////////////////
- if (`exists initHelpLine`) {
- setStartupMessage("Initializing Help Line.");
- eval "source initHelpLine";
- }
-
- ////////////////////////////////////////////////////////////
- //
- // Toolbox.
- //
- ////////////////////////////////////////////////////////////
- if (`exists initHelpLine`) {
- setStartupMessage("Initializing Toolbox.");
- eval "source toolbox";
- }
- }
-
- if (`exists initAuxiliary`) {
- eval "source initAuxiliary";
- }
-
- // Set minor nodes that will not appear in Maya UI.
- //
- if (`exists initMinorNodeTypes`) {
- eval "source initMinorNodeTypes";
- }
-
- if (`window -exists $gMainWindow`) {
- if (`exists initMainMenuBar`) {
- if ($printMemoryExists) {
- printMemory("Menu Bar Start");
- }
- setStartupMessage("Initializing Menu Bar.");
- source initMainMenuBar;
- if ($printMemoryExists) {
- printMemory("Menu Bar Complete");
- }
- }
-
- setStartupMessage("Initializing Colors.");
- if (`exists initColors`) eval "source initColors";
-
- setStartupMessage("Initializing Manipulators.");
- if (`exists initManipulators`) eval "source initManipulators";
-
- // Map the main window after initColors or refresh callbacks
- // on color changes will cause startup to be slow
- //
- setStartupMessage("Showing Maya Window.");
- showWindow $gMainWindow;
-
- // Launch the Learning Movies page
- //
- if (`exists mayaLearningMoviesPage`) {
- if (!`optionVar -exists showLearningMoviesOnStartup`) {
- optionVar -intValue showLearningMoviesOnStartup true;
- }
- if (`optionVar -query showLearningMoviesOnStartup` == true) {
- evalDeferred "mayaLearningMoviesPage";
- }
- }
-
- // Initialize each modeling panel to color-index mode
- //
- string $modelPanels[] = `getPanel -type modelPanel`;
- for ( $modelPanel in $modelPanels ) {
- modelEditor -edit -useColorIndex true $modelPanel;
- }
-
- updateUIComponentCloseButtons();
- }
-
- // These globals are used internally and need to be declared in advance.
- //
- global string $gBuffStr;
- global string $gBuffStr0;
- global string $gBuffStr1;
- global string $gBuffStrArr[];
-
- // Not sure where to declare this, so..
- //
- // This variable is used to store the last action
- // the user performed, or the last tool that they
- // were using before switching to another tool
- //
- // Note: Really the global variable $gSelect should be used instead
- // of hard coding selectSuperContext but the syntax doesn't allow it.
- //
- global string $gLastAction = "setToolTo selectSuperContext";
-
- // This variable stores the current working mode of maya
- //
- global string $gMayaMode;
- $gMayaMode = `optionVar -q mayaMode`;
-
- //
- // Make sure the UI reflects the working mode of the previous session
- //
- workingMode $gMayaMode;
-
- // The next variable is used to allow the user to
- // quickly return to a 'working' keyframe. This
- // allows user to scrub through time to evaluate the
- // effects of changing/setting a keyframe, and
- // quickly return to that frame to make further
- // changes, if necessary.
- //
- global float $gCurrentWorkingFrame = 1;
- if ($printMemoryExists) {
- printMemory("Layout complete");
- }
-
- // Initialize the help broswer
- //
- global int $gUseHelpBrowserWin;
- global int $gRaiseHelpBrowserWin;
- global string $gHelpBrowserWinID = "";
-
- $gUseHelpBrowserWin = `optionVar -q helpBrowserUseWindow`;
- $gRaiseHelpBrowserWin = `optionVar -q helpBrowserRaiseWindow`;
-
- // Initialize the last saved states for the UI elements.
- // On startup the last saved state is the same as the
- // current state. After one 'Hide UI Elements' is done
- // they will be different. These states are set earlier
- // in this file so don't move this stuff up. The strange
- // syntax is to get around the restriction that globals
- // be initialized with a constant.
- //
- global int $gLastStateComponentBar;
- global int $gLastStateStatusLine;
- global int $gLastStateShelf;
- global int $gLastStateTimeSlider;
- global int $gLastStatePlaybackRange;
- global int $gLastStateCommandLine;
- global int $gLastStateHelpLine;
- global int $gLastStateToolbox;
- global int $gLastStateAE;
- global int $gLastStateToolSettings;
- global int $gLastStateChannelsLayers;
-
- $gLastStateStatusLine = isUIComponentVisible("Status Line");
- $gLastStateShelf = isUIComponentVisible("Shelf");
- $gLastStateTimeSlider = isUIComponentVisible("Time Slider");
- $gLastStatePlaybackRange = isUIComponentVisible("Range Slider");
- $gLastStateCommandLine = isUIComponentVisible("Command Line");
- $gLastStateHelpLine = isUIComponentVisible("Help Line");
- $gLastStateToolbox = isUIComponentVisible("Tool Box");
- $gLastStateAE = isUIComponentVisible("Attribute Editor");
- $gLastStateToolSettings = isUIComponentVisible("Tool Settings");
- $gLastStateChannelsLayers = isUIComponentVisible("Channel Box / Layer Editor");
-
- // Initialize selection masks
- //
- source selectionMaskStackInit;
- }
-